package com.yueyang.sojourn.server.service.sojourn.merch;

import com.yueyang.sojourn.server.model.po.SojournMerch;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author yemingxing
 * @summary
 * @Copyright (c) 2020, Yueyang Group All Rights Reserved.
 * @since 2020-02-17
 */
@Service
public class SojournMerchService {

    @Resource
    private SojournMerchMapper sojournMerchMapper;


    public int deleteByPrimaryKey(Long id) {
        return sojournMerchMapper.deleteByPrimaryKey(id);
    }


    public int insert(SojournMerch record) {
        return sojournMerchMapper.insert(record);
    }


    public int insertSelective(SojournMerch record) {
        return sojournMerchMapper.insertSelective(record);
    }


    public SojournMerch selectByPrimaryKey(Long id) {
        return sojournMerchMapper.selectByPrimaryKey(id);
    }


    public int updateByPrimaryKeySelective(SojournMerch record) {
        return sojournMerchMapper.updateByPrimaryKeySelective(record);
    }


    public int updateByPrimaryKey(SojournMerch record) {
        return sojournMerchMapper.updateByPrimaryKey(record);
    }

    public List<SojournMerch> findBy(String keyWord, Long projectId, List<Integer> shelfStatus) {
        return sojournMerchMapper.findBy(keyWord, projectId, shelfStatus);
    }

    public List<SojournMerch> selectByShelfStatus(int shelfStatus) {
        return sojournMerchMapper.selectByShelfStatus(shelfStatus);
    }

    public void updateShelfStatusByIds(int shelfStatus, List<Long> merchIds) {
        if (CollectionUtils.isEmpty(merchIds)) {
            return;
        }
        sojournMerchMapper.updateShelfStatusByIds(shelfStatus, merchIds);
    }

    public List<SojournMerch> findCollectList(long userId) {
        return sojournMerchMapper.selectCollectList(userId);
    }

    public List<SojournMerch> findByLayoutId(int layoutId, Integer shelfStatus) {
        return sojournMerchMapper.findByLayoutId(layoutId, shelfStatus);
    }

    public List<SojournMerch> findByIds(List<Long> ids){
        return sojournMerchMapper.findByIds(ids);
    }
}
